#define DEBUG
#include <cstdio>
#define MAXN 5000
#define MODS 1000000007

using namespace std;

int main() {
#ifdef DEBUG
  freopen("0.in", "r", stdin);
  freopen("0.out", "w", stdout);
#endif

  int n, c;
  static bool book[MAXN+1][MAXN+1];
  scanf("%d %d", &n, &c);
  for (int i=1; i<=c; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    book[x][y] = true;
  }

  static long long f[MAXN+1][MAXN+1];
  f[0][0] = 1;
  for (int i=0; i<=n; i++) {
    for (int j=0; j<=i; j++) {
      if (!book[i][j]) {
	if (i>0) {
	  f[i][j] = (f[i][j]+f[i-1][j])%MODS;
	}
	if (j>0) {
	  f[i][j] = (f[i][j-1]+f[i][j])%MODS;
	}
      }
    }
  }
  printf("%lld\n", f[n][n]);

  fcloseall();
  return 0;
}
